# Pandas
import pandas as pd

# 构建Series
# 通过列表构建
series1 = pd.Series(data=["python", "java", "sql"])
print(series1)

series1 = pd.Series(data=["python", "java", "sql"], index=[2, 3, 4])
print(series1)

# 通过字典构建
# 下标为Key值
dict = {
    "index1": "Python",
    "index2": "java",
    "index3": "sql"
}

print(pd.Series(data=dict))

# Dataframe

dict = {
    "language": ["python", "java", "sql"],
    "application": ["pySpark", "Hadoop", "hive"]
}

df1 = pd.DataFrame(data=dict)
print(df1)

# drop 默认不删除原DataFrame
df2 = df1.drop(labels="application", axis=1)
print(df2)

# inplace参数表示替换原DataFrame
# df1.drop(labels="application", axis=1, inplace=True)
# print(df1)

# del df1['application']
# del df1.application  不能用.列名称删除列数据
# print(df1)


# # 取出对应列的值
# print("*******************")
# # 方式一：
# print(df1['application'])
#
# # 方式二：
# print(df1.application)
#
# # 方式三：
# # 取出多列
# print(df1[["language","application"]])


# 通过loc方法进行取指定下标的数据
print(df1.loc[[1, 2]])

print(df1.index > 0)
print(df1[df1.index > 0])

dict = {
    "name": ["zhangsan", "lisi", "wangwu"],
    "socre": [70, 80, 90],
    "age": [18, 19, 20]
}

df3 = pd.DataFrame(data=dict)
print(df3.socre.count())
print(df3.socre.sum())
print(df3['socre'].max())
print(df3['socre'].min())
print(df3['socre'].describe())
print(df3.describe())


print(type(df3['socre']))


# 安装 jupyter notebook
# pip install jupyter notebook




# pip 命令
'''
    python -m pip install --upgrade pip  更新pip
    install  库名称   下载库
    uninstall 库名   卸载库
    list  查看已下载的库
    show 库名称  查看对于库的信息
    
'''